package storage.v1;

import com.onpositive.data.IPropertyConstants;
import com.onpositive.knowledge.model.IThing;
import com.onpositive.mediawiki.propertyparser.PropertyCharacteristic;
import com.onpositive.semantic.model.api.meta.BaseMeta;
import com.onpositive.semantic.model.api.meta.IMeta;
import com.onpositive.semantic.model.api.property.IProperty;
import com.onpositive.units.ParsedString;

public class DocumentIdProperty implements IProperty {
	
	public static final String PROPERTY_NAME = "name-property-metadata" ;
	
	private BaseMeta meta ;
	
	public DocumentIdProperty()
	{
		meta = new BaseMeta() ;
		meta.putMeta( PropertyCharacteristic.CHAR_PARSER_ID_LABEL, ParsedString.ID ) ;
		meta.putMeta(PropertyCharacteristic.CHAR_PROPERTY_NAME_LABEL,PROPERTY_NAME );
		meta.putMeta(IPropertyConstants.CHAR_IS_SERVICE_PROPERTY , true );
	}

	@Override
	public IMeta getMeta() {

		return meta;
	}

	@Override
	public String getId() {

		return PROPERTY_NAME;
	}

	@Override
	public Object getValue(Object obj) {
		
		return (obj instanceof IThing) ? new ParsedString( ((IThing) obj).getId(), "DocumentIdProperty" ) : null ;

	}

}
